package com.aierkeji.call.cms.util;

import java.util.Locale;

import com.google.i18n.phonenumbers.NumberParseException;
import com.google.i18n.phonenumbers.PhoneNumberUtil;
import com.google.i18n.phonenumbers.Phonenumber;
import com.google.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder;

public class PhoneUtil {		
	static PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
	static PhoneNumberOfflineGeocoder phoneNumberOfflineGeocoder = PhoneNumberOfflineGeocoder.getInstance();

	public static String getCity(String phoneNum) {
		String language = "CN";
		Phonenumber.PhoneNumber referencePhonenumber = null;
		try {
			referencePhonenumber = phoneUtil.parse(phoneNum, language);
		} catch (NumberParseException e) {
			e.printStackTrace();
		}
		// 手机号码归属城市 city
		String city = phoneNumberOfflineGeocoder.getDescriptionForNumber(referencePhonenumber, Locale.CHINA);
		return city;
	}
	
}
